function encode_url(url){
        var ss = url.match(/\w*link.*?(?=&\w*link)/);
        var arr = new Array();
        var lnum = url.match(/link/g).length;
        if (lnum > 0){
            var i=0;
            for (i;i<lnum-1;i++){
                arr[i]=url.match(/\w*link.*?(?=&\w*link)/).toString();
                url=url.replace(/&\w*link.*?(?=&\w*link)/,'');
            }
            arr[i]=url.match(/\w*link.*/).toString();
            url=url.replace(/&\w*link.*/,'');
        };

        var param = new Array();
        param = url.split('&');
        param = param.concat(arr);
        for (var i=0;i<param.length;i++){
            var temp=param[i].split('=');
            if (temp.length > 2){
                var t=temp.shift();
                param[i] = [t,encodeURIComponent(temp.join('='))].join('=');
            }else if (temp.length == 2){
                param[i] = [temp[0],encodeURIComponent(temp[1])].join('=');
            };
        }
        //alert(arr.join('&'));
        var res = param.join('&');
        location.href= res;
        //return res
    }